var api     = require('../../utils/api.js');
var WxParse = require('../../wxParse/wxParse.js');
var app     = getApp();
Page({
    data: {post:[]},
    onLoad(params) {
        this.params = params;
    },
    onReady() {
        this.loadData();
    },
    loadData() {
        var params = this.params;
        if (params.id) {
            wx.showNavigationBarLoading();
            api.put({
                url: 'logi/Userlogis/express',
                data: {'id':params.id,'status':params.status},
                success: data => {
                    wx.hideNavigationBarLoading();
                    if (data.code) {
                        this.setData({post: data.data});
                        if (params.status==2) {
                            wx.setNavigationBarTitle( { title: '驿站快递单号' } );
                        } else if (params.status==3) {
                            wx.setNavigationBarTitle( { title: '小站快递单号' } );
                        }
                    }
                },
                fail: err => {
                    wx.hideNavigationBarLoading();
                }
            });
        }

    },
    copyExp(e){
        wx.setClipboardData({
            data: e.target.dataset.exp,
            success: function(res) {
                wx.getClipboardData({
                    success: function(res) {
                        wx.showToast({
                            title: '复制成功',
                            icon: 'success',
                            duration: 800
                        })
                    }
                })
            }
        })
    },
    goBack() {
        wx.navigateBack({ delta: 2 });
    },
    onShareTap() {
        wx.showShareMenu({
            withShareTicket: true
        });
    },
    onShareAppMessage() {
        return {
            title: '樱花驿站',
            path: '/pages/index/index'
        }
    }

});
